// 路由 createBrowserRouter：history路由 createHashRouter：哈希路由
import { createBrowserRouter } from 'react-router-dom';


import App from '@/App.jsx';
import AppLogin from '@/views/login/AppLogin';
import Home from '@/views/home/Home';
import HomeCount from '@/views/homecount/HomeCount';

import AccountList from '@/views/account/AccountList';
import AccountEdit from '@/views/account/AccountEdit.jsx';
import AccountCenter from '@/views/account/AccountCenter';
import AccountAdd from '@/views/account/AccountAdd';

import GoodsAdd from '@/views/goods/GoodsAdd';
import GoodsList from '@/views/goods/GoodsList';
import GoodsType from '@/views/goods/GoodsType';

import OrderList from '@/views/order/OrderList';

import ShopInfo from '@/views/shop/ShopInfo';

import PermissionInfo from '@/views/permission/PermissionInfo';
import RolePermission from '@/views/permission/RolePermission';

import GoodsStatistics from '@/views/tatistics/GoodsStatistics';
import OrderStatistics from '@/views/tatistics/OrderStatistics';
import GoodsEidt from '@/views/goods/GoodsEidt';
import OrderEdit from '@/views/order/OrderEdit';
import { Component } from 'react';

const routers = [
  {
    path:'/',
    Component:App,
    children:[
      {
        index:true,
        Component:AppLogin
      },
      {
        path:'home',
        Component:Home,
        children:[
          {
            index:true,
            Component:HomeCount
          },
          {
            path:'goodsEdit',
            Component:GoodsEidt
          },{
            path:'orederEdit',
            Component:OrderEdit
          }
        ]
      },
      //账号管理
      {
        path:'home',
        Component:Home,
        children:[
          {
            path:'accountList',
            Component:AccountList,
            meta:{
              title:'账号列表',
            }
          },
          {
            path:'accountEdit',
            Component:AccountEdit
          },
          {
            path:'accountCenter',
            Component:AccountCenter
          },
          {
            path:'accountAdd',
            Component:AccountAdd
          },
        ]
      },
      //商品管理
      {
        path:'home',
        Component:Home,
        children:[
          {
            path:'goodsList',
            Component:GoodsList
          },
          {
            path:'goodsAdd',
            Component:GoodsAdd
          },
          {
            path:'goodsType',
            Component:GoodsType
          },
        ]
      },
      //订单管理
      {
        path:'home',
        Component:Home,
        children:[
          {
            index:true,
            path:'orderList',
            Component:OrderList
          }
        ]
      },
      //店铺
      {
        path:'home',
        Component:Home,
        children:[
          {
            index:true,
            path:'shopInfo',
            Component:ShopInfo
          }
        ]
      },
      //数据统计
      {
        path:'home',
        Component:Home,
        children:[
          {
            path:'goosStatistics',
            Component:GoodsStatistics
          },{
            path:'orderStatistics',
            Component:OrderStatistics
          }
        ]
      },
      //权限管理
      {
        path:'home',
        Component:Home,
        children:[
          {
            path:'permissionInfo',
            Component:PermissionInfo
          },
          {
            path:'rolePermission',
            Component:RolePermission
          }
        ]
      }
    ]
  }
]

export default createBrowserRouter(routers);